import {
    createApp
} from 'vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import 'virtual:svg-icons-register'
import gloablComponent from './components/index';
import "@/styles/index.scss";
import router from "@/router/index";
import '@/router/permission.js'
import pinia from '@/store/index'
import App from './App.vue'
import loginStore from "@/store/login/index.js";
async function router_fun() {
    let $loginStore = loginStore(pinia);
    await $loginStore.router_fun()
}




async function init() {
    let luser = localStorage.getItem('luser')
    if (luser) {
        await router_fun()
    }

    const app = createApp(App)
    app.use(ElementPlus, {
        locale: zhCn,
    })
    app.use(router);
    app.use(pinia)
    app.use(gloablComponent);
    app.mount('#app')
}

init()
